package com.facebook.app.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;

public class FacebookApp implements EntryPoint {
	
	private final RootPanel loginPanel = RootPanel.get("login_content");
	private final LoginContent login = new LoginContent();
	
	@Override
	public void onModuleLoad() {
		
		login.display(loginPanel);
		
		if (login.isLoggedIn()) {
			FacebookServiceAsync rpcService = GWT.create(FacebookService.class);
			HandlerManager eventBus = new HandlerManager(null);
			AppController appViewer = new AppController(rpcService, eventBus, login.getAuthCookie().getAccessToken());	
			appViewer.go(RootPanel.get("app_content"));
		}		
	}

}
